<?php

use Illuminate\Database\Seeder;
use App\Models\Subject;
use Faker\Factory;

class SubjectTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //        非模型工厂填充数据
        Subject::truncate();
        $faker = Factory::create('zh_CN');

        $data = [];
        for($i=0;$i<1500;$i++){
            $data[] = [
                'subject_name' => $faker->unique()->name,
                'logo' => $faker->unique()->phoneNumber,
                'created_at' => date('Y-m-d H:i:s',mt_rand(strtotime('2018-01-01'),strtotime('2018-12-30'))),
            ];
        }

        Subject::insert($data);
    }
}
